﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class XacNhanDatHangaspx : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        hienThiDatHang.Visible = false;
        chiTietDatHang.Visible = false;
        try
        {
            string Ngaytest = Request.QueryString.Get("NgayTao");
            if(Ngaytest.ToString()!="")
            {
                Label1.Text= Ngaytest.ToString();
                hienThiDatHang.Visible = true;
            }
            try
            {
                string HangTest = Request.QueryString.Get("MaGioHang");
                if (HangTest.ToString() != "" && Ngaytest.ToString()!="")
                {
                    ThongBaoChiThiet.Text = HangTest.ToString();
                    hienThiDatHang.Visible = true;
                    chiTietDatHang.Visible = true;
                }
            }
            catch (Exception ex)
            {

            }
            
            
        }
        catch (Exception ex)
        {
        }
    }

    protected void Calendar1_SelectionChanged(object sender, EventArgs e)
    {
        DateTime datetime = Calendar1.SelectedDate;
        this.txtNgay.Text = datetime.Month + "/" + datetime.Day + "/" + datetime.Year;
    
    }
    protected void HienThi_Click(object sender, EventArgs e)
    {

            string Ngay = "%" + txtNgay.Text + "%";
            Response.Redirect("~/XacNhanDatHangaspx.Aspx?NgayTao=" + Ngay.ToString() + "");



    }
    protected void BtnXacNhan_Click(object sender, EventArgs e)
    {
        try
        {
            if (KiemTra.Checked == true)
            {
                string GoiHangTest = Request.QueryString.Get("MaGioHang");
                SanphamDTO XNSP = new SanphamDTO();
                UserDTO XNUS = new UserDTO();
                XNSP.MaGioHang1 = int.Parse(GoiHangTest.ToString());
                XNSP.Ngaydang = DateTime.Now.ToString();
                if (DropDownList1.Text.ToString() != "Chon")
                {
                    XNUS.Check1 = DropDownList1.Text;
                }
                else
                {
                    ThongBao.Text = "Chưa Chọn Tình Trạng";
                }
                SanPhamBUS.XacNhanTinhTRangGioHang(XNSP, XNUS);
                ThongBao.Text = "Đã Cập Nhập";
            }
            else
            {
                ThongBao.Text = "Xin Kiểm Tra Lại";
            }
        }
        catch (Exception ex)
        {

        }

    }
}